export function formatDate(timestamp) {
  // 处理字符串类型的时间戳
  if (typeof timestamp === 'string') {
    timestamp = parseInt(timestamp);
  }
  const date = new Date(timestamp);
  const month = date.getMonth() + 1;
  const day = date.getDate();
  return `${month}月${day}日`;
}

export function formatDateHour(timestamp) {
  // 处理字符串类型的时间戳
  if (typeof timestamp === 'string') {
    timestamp = parseInt(timestamp);
  }

  const date = new Date(timestamp);
  const year = date.getFullYear();     // 获取年份
  const month = date.getMonth() + 1;   // 月份从0开始，要+1
  const day = date.getDate();
  const hours = date.getHours().toString().padStart(2, '0');   // 补零
  const minutes = date.getMinutes().toString().padStart(2, '0'); // 补零

  return `${year}-${month}-${day} ${hours}:${minutes}`;
}